package com.heima.feigns.article;


import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.vo.SearchArticleVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient("leadnews-article")
public interface ArticleFeign {

    @GetMapping("/api/v1/author/findByUserId/{userId}")
    public ApAuthor findByUserId(@PathVariable("userId") Integer userId);


    @PostMapping("/api/v1/author/save")
    public ResponseResult save(@RequestBody ApAuthor apAuthor);

    @PostMapping("/api/v1/article/save")
    public ResponseResult saveArticle(@RequestBody ArticleDto articleDto);

    @GetMapping("/api/v1/author/findByWmUserId/{wmUserId}")
    public ApAuthor findByWmUserId(@PathVariable("wmUserId") Integer wmUserId);

    @GetMapping("/api/v1/author/one/{id}")
    ApAuthor selectById(@PathVariable("id") Integer id);

    @GetMapping("/api/v1/article/findByArticleId/{id}")
    public ApArticle findByArticleId(@PathVariable("id") Long articleId);

    @GetMapping("/api/v1/article/findAllArticles")
    public List<ApArticle> findAllArticles();

    @GetMapping("/api/v1/article/{id}")
    SearchArticleVo findArticle(@PathVariable("id") Long id);
}
